

#include "stdafx.h"
#include "CSampleServerSchedulerIdentity.h"



CSampleServerSchedulerIdentity* CSampleServerSchedulerIdentity::m_cpSelf = NULL;

CSampleServerSchedulerIdentity::CSampleServerSchedulerIdentity() : m_IdentityCnt(TASK_LAST + 1)
{
	m_bOK = false;
	m_bOK = true;
}

CSampleServerSchedulerIdentity::~CSampleServerSchedulerIdentity()
{

}

unsigned int CSampleServerSchedulerIdentity::Get(void)
{
	const unsigned int identity = m_IdentityCnt;
	if(m_IdentityCnt >= UINT_MAX) m_IdentityCnt = TASK_LAST + 1;
	else m_IdentityCnt += 1;
	return identity;
}

bool CSampleServerSchedulerIdentity::CreateInstance(void)
{
	assert(NULL == m_cpSelf);
	if(NULL != m_cpSelf) return false;
	m_cpSelf = new(nothrow) CSampleServerSchedulerIdentity();
	if(NULL == m_cpSelf) return false;
	if(false == m_cpSelf->isOK()){ delete m_cpSelf; m_cpSelf = NULL; return false; }
	return true;
}

void CSampleServerSchedulerIdentity::DestroyInstance(void)
{
	assert( NULL != m_cpSelf );
	if( NULL != m_cpSelf ){ delete m_cpSelf; m_cpSelf = NULL; };
}







